package cn.ld.module.ai.dal.mapper.knowledge;

import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.module.ai.controller.admin.knowledge.vo.document.AiKnowledgeDocumentPageInVO;
import cn.ld.module.ai.dal.entity.knowledge.AiKnowledgeDocumentEntity;
import org.apache.ibatis.annotations.Mapper;

/**
 * AI 知识库-文档 Mapper
 *
 * @author xiaoxin
 */
@Mapper
public interface AiKnowledgeDocumentMapper extends BaseMapperX<AiKnowledgeDocumentEntity> {

    default PageResult<AiKnowledgeDocumentEntity> selectPage(AiKnowledgeDocumentPageInVO inVO) {
        return selectPage(inVO, new LambdaQueryWrapperX<AiKnowledgeDocumentEntity>()
                .likeIfPresent(AiKnowledgeDocumentEntity::getName, inVO.getName())
                .orderByDesc(AiKnowledgeDocumentEntity::getId));
    }

}
